home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / cg / rexxlauncher.rexx < prev    next >
OS/2 REXX Batch file  |  1996-01-08  |  1KB  |  56 lines

  1. /* RexxLauncher.rexx -- Launches CG Scripts */
  2. /* By Bob Caron © 1994 NewTek, Inc.         */
  3. /* This one just took HOURS to code         */
  4.  
  5. call remlib(CG_AREXX)
  6. call addlib(CG_AREXX,0)
  7.  
  8. filnam = 'ENV:RLauncher.state'
  9. version = 'RexxLauncher v1.4'
  10.  
  11. if (exists(filnam)) then do
  12.     if (~open(state, filnam, 'R')) then break
  13.     if (readln(state) ~= version) then break
  14.     file=readln(state)
  15.     end
  16.     call close state
  17.  
  18. if file~="" | file="FILE" then do
  19.    if lastpos('/',file,length(file)-1)~=0 then do
  20.       filenam=right(file,(length(file)-lastpos('/',file,length(file)-1)))
  21.       path=left(file,(lastpos('/',file,length(file))-1))
  22.       end
  23.    else do
  24.       filenam=right(file,(length(file)-lastpos(':',file,length(file)-1)))
  25.       path=left(file,(lastpos(':',file,length(file))))
  26.       end
  27.    end
  28. if file="FILE" | file="" then do
  29.    path="Rexx:CG"
  30.    filenam=""
  31.    end
  32.  
  33. script=REQ_FILE("Run Arexx Program",filenam,path)
  34.  
  35. file=script
  36. if (open(state, filnam, 'W')) then do
  37.     call writeln state, version
  38.     call writeln state, file
  39.     call close state
  40. end
  41.  
  42. if exists(script)=0 then do
  43.    call REQ_TELL("Macro not found.")
  44.    call remlib(CG_AREXX)
  45.    exit
  46.    end
  47.  
  48. call remlib(CG_AREXX)
  49.  
  50. cmd='rx '||script||''
  51.  
  52. address command cmd
  53.  
  54. exit
  55.  
  56.